package com.yuexunit.operationman.nbsy.module.AfterOperation.ui;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.AfterOperation.ui.fragment.Fragment_AO_Analgesia;
import com.yuexunit.operationman.nbsy.module.AfterOperation.ui.fragment.Fragment_AO_Postoperation;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/8/10 0010.
 */

public class Act_AfterOperation_Preview extends BaseKJActivity {

    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.tv_submit)
    TextView tvSubmit;
    @Bind(R.id.anesthesia_01)
    TextView anesthesia01;
    @Bind(R.id.preview_img_01)
    ImageView previewImg01;
    @Bind(R.id.anesthesia_02)
    TextView anesthesia02;
    @Bind(R.id.preview_img_02)
    ImageView previewImg02;

    Fragment_AO_Analgesia fragmentAoAnalgesia;
    Fragment_AO_Postoperation fragmentAoPostoperation;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_afteroperation_preview);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        fragmentAoAnalgesia = new Fragment_AO_Analgesia();
        fragmentAoPostoperation = new Fragment_AO_Postoperation();
        changeFragment(R.id.content, fragmentAoPostoperation);
        setTitle();
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.AFTEROPERATIONBEAN.getObject().getAoVisit().getPatientName());
        if (AppConfig.AFTEROPERATIONBEAN.getObject().getAoVisit().getPatientSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.AFTEROPERATIONBEAN.getObject().getAoVisit().getPatientSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.AFTEROPERATIONBEAN.getObject().getAoVisit().getInHospitalNo());
        tvPatientDisease.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DISEASE));
    }

    @OnClick({R.id.titlebar_docadvice_img_back, R.id.preview_ll_01, R.id.preview_ll_02})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.preview_ll_01:
                previewImg01.setVisibility(View.VISIBLE);
                previewImg02.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentAoPostoperation);
                break;
            case R.id.preview_ll_02:
                previewImg01.setVisibility(View.INVISIBLE);
                previewImg02.setVisibility(View.VISIBLE);
                changeFragment(R.id.content, fragmentAoAnalgesia);
                break;
        }
    }
}
